#%RAML 1.0 Library
uses:
  strings: stringTypes.raml
  command: mesosCommand.raml
  numbers: numberTypes.raml
  check: check.raml
types:
  HealthCheck:
    properties:
      http?: check.HttpCheck
      tcp?: check.TcpCheck
      exec?:
        type: check.CommandCheck
        description: |
          Command that executes some health check process.
          Use with pods requires Mesos v1.2 or higher.
      gracePeriodSeconds?:
        type: integer
        format: int32
        description: |
          Health check failures are ignored within this number of seconds of
          the task being started or until the task becomes healthy for the
          first time.
        minimum: 0
        default: 300
      intervalSeconds?:
        type: integer
        format: int32
        description: Interval between the health checks
        minimum: 0
        default: 60
      maxConsecutiveFailures?:
        type: integer
        format: int32
        description: Number of consecutive failures until the task will be killed
        minimum: 0
        default: 3
      timeoutSeconds?:
        type: integer
        format: int32
        description: Amount of time to wait for the health check to complete.
        minimum: 0
        default: 20
      delaySeconds?:
        type: integer
        format: int32
        description: Amount of time to wait until starting the health checks.
        minimum: 0
        default: 15
    usage: Must specify a single type of check, http, tcp, or exec
  AppHealthCheckProtocol:
    type: string
    enum: [HTTP, HTTPS, TCP, COMMAND, MESOS_TCP, MESOS_HTTP, MESOS_HTTPS]
    description: |
      Protocol of the requests to be performed.
  AppCommandCheck:
    properties:
      value:
        type: string
        description: |
          Command line executed by the default shell.
          This process has to return with a zero exit code to indicate the process is healthy.
          Return codes other than null signal, the task is unhealthy.
  AppHealthCheck:
    type: object
    properties:
      command?: AppCommandCheck
      gracePeriodSeconds?:
        type: integer
        format: int32
        description: |
          Health check failures are ignored within this number of seconds of
          the task being started or until the task becomes healthy for the
          first time.
        minimum: 0
        default: 300
      ignoreHttp1xx?:
        type: boolean
        description: Ignore HTTP 1xx responses
      intervalSeconds?:
        type: integer
        format: int32
        description: Number of seconds to wait between health checks
        minimum: 0
        default: 60
      maxConsecutiveFailures?:
        type: integer
        format: int32
        description: |
          Number of consecutive health check failures after which the
          unhealthy task should be killed.
        minimum: 0
        default: 3
      path?:
        type: string
        description: |
          Path to endpoint exposed by the task that will provide health status.
          Note: only used if protocol == HTTP[S]."
        example: /path/to/health
      port?:
        type: numbers.AnyPort
        description: |
          The specific port to connect to.
          In case of dynamic ports, see portIndex.
      portIndex?:
        type: numbers.AnyPort
        description: |
          Index in this app's ports array to be used for health requests.
          An index is used so the app can use random ports,
          like [0, 0, 0] for example, and tasks could be started with
          port environment variables like $PORT1.
      protocol?:
        type: AppHealthCheckProtocol
        default: HTTP
      ipProtocol?:
        type: strings.IpProtocol
        default: IPv4
      timeoutSeconds?:
        type: integer
        format: int32
        default: 20
        description: |
          Number of seconds after which a health check is considered a failure
          regardless of the response.
      delaySeconds?:
        type: integer
        format: int32
        description: Amount of time to wait until starting the health checks.
        minimum: 0
        default: 15
  Health:
    type: object
    properties:
      alive: boolean
      consecutiveFailures:
        type: number
        format: int32
      firstSuccess?: string
      instanceId: strings.InstanceId
      lastSuccess?: string
      lastFailure?: string
      lastFailureCause?: string